From b67e36df49f067cbd5ba899f9fbcc755f38d4b4f Mon Sep 17 00:00:00 2001 From: dujinkim Date: Thu, 4 Sep 2025 08:31:31 +0000 Subject: (대표님, 최겸, 임수민) 작업사항 커밋 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/[lng]/admin/edp-progress-debug/page.tsx | 210 ++++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 app/[lng]/admin/edp-progress-debug/page.tsx (limited to 'app/[lng]/admin/edp-progress-debug') diff --git a/app/[lng]/admin/edp-progress-debug/page.tsx b/app/[lng]/admin/edp-progress-debug/page.tsx new file mode 100644 index 00000000..ebaa07a2 --- /dev/null +++ b/app/[lng]/admin/edp-progress-debug/page.tsx @@ -0,0 +1,210 @@ +"use client"; + +import React from 'react'; +import { Button } from '@/components/ui/button'; +import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; +import { Input } from '@/components/ui/input'; +import { Label } from '@/components/ui/label'; +import { Badge } from '@/components/ui/badge'; +import { ScrollArea } from '@/components/ui/scroll-area'; +import { debugVendorFieldCalculation } from '@/lib/forms/vendor-completion-stats'; +import { Loader, Search, FileText, Tag, CheckCircle, XCircle } from 'lucide-react'; +import { toast } from 'sonner'; + +export default function DebugVendorFieldsPage() { + const [loading, setLoading] = React.useState(false); + const [vendorId, setVendorId] = React.useState('1'); + const [debugData, setDebugData] = React.useState(null); + + const handleDebug = async () => { + setLoading(true); + setDebugData(null); + + try { + const result = await debugVendorFieldCalculation(Number(vendorId)); + setDebugData(result); + + if (result) { + toast.success(`${result.vendorName}의 필드 계산 디버그 완료`); + } else { + toast.warning('벤더 데이터가 없습니다'); + } + } catch (error) { + console.error('Error debugging vendor fields:', error); + toast.error(`디버그 실패: ${error instanceof Error ? error.message : '알 수 없는 오류'}`); + } finally { + setLoading(false); + } + }; + + const renderFieldDetails = (fieldDetails: any[]) => ( +
+ {fieldDetails.map((field, index) => ( +
+ {field.fieldKey} + = + {String(field.fieldValue ?? 'null')} + {field.isEmpty ? ( + + ) : ( + + )} +
+ ))} +
+ ); + + return ( +
+
+ +

벤더 필드 계산 디버그

+
+ + {/* Input */} + + + 벤더 ID 입력 + + +
+
+ + setVendorId(e.target.value)} + placeholder="1" + type="number" + /> +
+
+ +
+
+
+
+ + {/* Results */} + {debugData && ( +
+ {/* Summary */} + + + + + {debugData.vendorName} - 전체 요약 + + + +
+
+
+ {debugData.debugInfo.grandTotal.totalRequiredFields} +
+

전체 필드

+
+
+
+ {debugData.debugInfo.grandTotal.totalFilledFields} +
+

입력 필드

+
+
+
+ {debugData.debugInfo.grandTotal.totalEmptyFields} +
+

빈 필드

+
+
+
+ {debugData.debugInfo.grandTotal.completionPercentage}% +
+

완성도

+
+
+
+
+ + {/* Detailed Breakdown */} + + + 상세 분석 + + + +
+ {debugData.debugInfo.contracts.map((contract: any, contractIndex: number) => ( +
+
+ + + 계약 {contract.contractId} - {contract.projectName} + + + 전체: {contract.totalRequiredFields} | 입력: {contract.totalFilledFields} + +
+ +
+ {contract.forms.map((form: any, formIndex: number) => ( +
+
+ + {form.formName} ({form.formCode}) + + 전체: {form.totalRequiredFields} | 입력: {form.totalFilledFields} + +
+ +
+ {form.tags.map((tag: any, tagIndex: number) => ( +
+
+ + {tag.tagNo} + + 전체: {tag.requiredFieldsCount} | 입력: {tag.filledFieldsCount} + +
+ +
+
+ 편집 가능한 필드: {tag.editableFields.join(', ')} +
+ {renderFieldDetails(tag.fieldDetails)} +
+
+ ))} +
+
+ ))} +
+
+ ))} +
+
+
+
+ + {/* Raw Data */} + + + 원시 데이터 (JSON) + + + +
+                  {JSON.stringify(debugData, null, 2)}
+                
+
+
+
+
+ )} +
+ ); +} \ No newline at end of file -- cgit v1.2.3